package demo07.Revoke.control;

import demo07.Revoke.commandImp.CeilingFanHighCommand;
import demo07.Revoke.commandImp.CeilingFanMediumCommand;
import demo07.Revoke.commandImp.CeilingFanOffCommand;
import demo07.Revoke.commandImp.LightOffCommand;
import demo07.Revoke.commandImp.LightOnCommand;
import demo07.Revoke.object.CeilingFan;
import demo07.Revoke.object.Light;

public class RemoteLoaderTest {
	public static void main(String[] args) {
		RemoteControlWithUndo remoteControl  = new RemoteControlWithUndo();
		//灯
		Light livingRoomLight = new Light("卧室");
		//命令
		LightOnCommand livingRoomLightOn = 
				new LightOnCommand(livingRoomLight);
		LightOffCommand livingRoomLightOff = 
				new LightOffCommand(livingRoomLight);
 
		remoteControl.setCommand(0, livingRoomLightOn, livingRoomLightOff);
 
		remoteControl.onButtonWasPushed(0);//打开
		remoteControl.offButtonWasPushed(0);//关闭
		System.out.println(remoteControl);
		remoteControl.undoButtonWasPushed();//撤销
		
		remoteControl.offButtonWasPushed(0);//关闭
		remoteControl.onButtonWasPushed(0);//打开
		System.out.println(remoteControl);
		remoteControl.undoButtonWasPushed();//撤销》》》》结果为关闭
		
		
		//风扇
		CeilingFan ceilingFan  = new CeilingFan("客厅");
		
		CeilingFanMediumCommand ceilingFanMedium = 
				new CeilingFanMediumCommand(ceilingFan);//中速
		CeilingFanHighCommand ceilingFanHigh = 
				new CeilingFanHighCommand(ceilingFan);//高速
		CeilingFanOffCommand ceilingFanOff = 
				new CeilingFanOffCommand(ceilingFan);//关闭

		remoteControl.setCommand(0, ceilingFanMedium, ceilingFanOff);//0  中速
		remoteControl.setCommand(1, ceilingFanHigh, ceilingFanOff);//1 高速
   
		remoteControl.onButtonWasPushed(0);//中速开启
		remoteControl.offButtonWasPushed(0);//中速关闭
		System.out.println(remoteControl);
		remoteControl.undoButtonWasPushed();//撤销
  
		remoteControl.onButtonWasPushed(1);//高速开启
		System.out.println(remoteControl);
		remoteControl.undoButtonWasPushed();//撤销》》》》应该结果为中速
	}
/*	打开灯
	关闭灯

	------ 远程控制 -------
	[位置 0] 开启类demo07.Revoke.commandImp.LightOnCommand   关闭类 demo07.Revoke.commandImp.LightOffCommand
	[位置 1] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 2] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 3] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 4] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 5] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 6] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand

	灯光调暗到 100%
	关闭灯
	打开灯

	------ 远程控制 -------
	[位置 0] 开启类demo07.Revoke.commandImp.LightOnCommand   关闭类 demo07.Revoke.commandImp.LightOffCommand
	[位置 1] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 2] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 3] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 4] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 5] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 6] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand

	关闭灯
	客厅风扇在中速挡
	客厅 风扇关了

	------ 远程控制 -------
	[位置 0] 开启类demo07.Revoke.commandImp.CeilingFanMediumCommand   关闭类 demo07.Revoke.commandImp.CeilingFanOffCommand
	[位置 1] 开启类demo07.Revoke.commandImp.CeilingFanHighCommand   关闭类 demo07.Revoke.commandImp.CeilingFanOffCommand
	[位置 2] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 3] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 4] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 5] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 6] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand

	客厅风扇在中速挡
	客厅 风扇在高速挡

	------ 远程控制 -------
	[位置 0] 开启类demo07.Revoke.commandImp.CeilingFanMediumCommand   关闭类 demo07.Revoke.commandImp.CeilingFanOffCommand
	[位置 1] 开启类demo07.Revoke.commandImp.CeilingFanHighCommand   关闭类 demo07.Revoke.commandImp.CeilingFanOffCommand
	[位置 2] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 3] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 4] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 5] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand
	[位置 6] 开启类demo07.Revoke.nocommand.NoCommand   关闭类 demo07.Revoke.nocommand.NoCommand

	客厅风扇在中速挡
	*/

}
